package com.me.waterphase.listener;

import com.badlogic.gdx.physics.box2d.Contact;
import com.badlogic.gdx.physics.box2d.ContactImpulse;
import com.badlogic.gdx.physics.box2d.Manifold;
import com.me.waterphase.listener.contact.EdgeContact;

public class EdgeListener {

	public static void beginContact(Contact contact, boolean _isA) {
		
		if((_isA && contact.getFixtureB().getUserData() == null) || (!_isA && contact.getFixtureA().getUserData() == null))
		{
			if(_isA)
				((EdgeContact) contact.getFixtureA().getUserData()).increment();
			else
				((EdgeContact) contact.getFixtureB().getUserData()).increment();
		}
	}

	public static void endContact(Contact contact, boolean _isA) {
		if((_isA && contact.getFixtureB().getUserData() == null) || (!_isA && contact.getFixtureA().getUserData() == null))
		{
			if(_isA)
				((EdgeContact) contact.getFixtureA().getUserData()).decrement();
			else
				((EdgeContact) contact.getFixtureB().getUserData()).decrement();
		}
	}

	public static void preSolve(Contact contact, Manifold oldManifold, boolean _isA) {
		// TODO Auto-generated method stub
		
	}

	public static void postSolve(Contact contact, ContactImpulse impulse, boolean _isA) {
		// TODO Auto-generated method stub
		
	}

}
